package com.yc.chatroom.server.pojo.po;

import javax.persistence.*;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;

@Entity
@DynamicInsert(true)//只有非null时才插入
@DynamicUpdate(true)//只有非null时才更新
//解决entity直接返回页面被转为json时出错
@JsonIgnoreProperties(value={"hibernateLazyInitializer","handler","fieldHandler"})
@Table(name = "cs_user")
public class UserPo {
	
	/**
	 * 用户id
	 * 用户的唯一标志
	 */
	@Id
	@Column(name = "user_id", unique = true, nullable = false)
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	private Integer userId;

	/**
	 * 用户账号
	 */
	@Column(name = "user_account")
	private String userAccount;

	/**
	 * 用户密码
	 */
	@Column(name = "user_password")
	private String userPassword;

	/**
	 * 用户名称
	 */
	@Column(name = "user_name")
	private String userName;

	/**
	 * 用户头像
	 */
	@Column(name = "user_photo")
	private byte[] userPhoto;

	/**
	 * 用户在线状态
	 */
	@Column(name = "user_online_status")
	private Integer userOnlineStatus;

	/**
	 * 用户最后登陆时间
	 */
	@Column(name = "user_last_login_time")
	private Long userLastLoginTime;

	/**
	 * 用户最后登出时间
	 */
	@Column(name = "user_last_logout_time")
	private Long userLastLogoutTime;
	
	/**
	 * 最后修改时间
	 */
	@Column(name = "last_modify_time")
	private Long lastModifyTime;

	public UserPo() {
	}

	public UserPo(Integer userId, String userAccount, String userPassword, String userName, byte[] userPhoto,
			Integer userOnlineStatus, Long userLastLoginTime, Long userLastLogoutTime, Long lastModifyTime) {
		super();
		this.userId = userId;
		this.userAccount = userAccount;
		this.userPassword = userPassword;
		this.userName = userName;
		this.userPhoto = userPhoto;
		this.userOnlineStatus = userOnlineStatus;
		this.userLastLoginTime = userLastLoginTime;
		this.userLastLogoutTime = userLastLogoutTime;
		this.lastModifyTime = lastModifyTime;
	}

	public Integer getUserId() {
		return userId;
	}

	public void setUserId(Integer userId) {
		this.userId = userId;
	}

	public String getUserAccount() {
		return userAccount;
	}

	public void setUserAccount(String userAccount) {
		this.userAccount = userAccount;
	}


	public String getUserName() {
		return userName;
	}

	public void setUserName(String userName) {
		this.userName = userName;
	}

	public String getUserPassword() {
		return userPassword;
	}

	public void setUserPassword(String userPassword) {
		this.userPassword = userPassword;
	}

	public byte[] getUserPhoto() {
		return userPhoto;
	}

	public void setUserPhoto(byte[] userPhoto) {
		this.userPhoto = userPhoto;
	}

	public Integer getUserOnlineStatus() {
		return userOnlineStatus;
	}

	public void setUserOnlineStatus(Integer userOnlineStatus) {
		this.userOnlineStatus = userOnlineStatus;
	}

	public Long getUserLastLoginTime() {
		return userLastLoginTime;
	}

	public void setUserLastLoginTime(Long userLastLoginTime) {
		this.userLastLoginTime = userLastLoginTime;
	}
	
	public Long getUserLastLogoutTime() {
		return userLastLogoutTime;
	}

	public void setUserLastLogoutTime(Long userLastLogoutTime) {
		this.userLastLogoutTime = userLastLogoutTime;
	}

	public Long getLastModifyTime() {
		return lastModifyTime;
	}

	public void setLastModifyTime(Long lastModifyTime) {
		this.lastModifyTime = lastModifyTime;
	}
}
